<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>

    <h3></h3>


    <button>立即购买</button>

    <script src="../js/ajax.js"></script>

    <script>

        const str = location.search.replace('?' , '')  ;
        console.log(str);
        const arr = str.split('=') ;
        const id = arr[1]

        ajax({
            url : 'http://43.138.81.225/php/detail.php' ,
            type : 'get' ,
            data : {
                id 
            } , 
            success : data => {
                console.log(data);
                render(data.data)
            }
        })


        function render(data) {
            const oH3 = document.querySelector('h3') ;
            oH3.innerHTML = data.goods_title ;
        }

    </script>
    
</body>
</html>